#! /bin/bash

for data_file in ../data/*.in
do
	data_file_name=$(basename $data_file)_par
	file=bassi/bench_$data_file_name.batch
	echo "#@ job_name	= like_$data_file_name" > $file
	echo "#@ output	= ../results/bassi/like_$data_file_name.out">> $file
	echo "#@ error	= ../results/bassi/like_$data_file_name.err">> $file
	echo "#@ job_type	= parallel" >> $file
	echo "#@ node_usage	= not_shared">> $file
	echo "#@ network.MPI = sn_all,not_shared,us">> $file
	echo "#@ class = regular">> $file
	echo "#@ shell	= /bin/sh">> $file
	echo "#">> $file
	echo "#">> $file
	echo "#@ tasks_per_node	= 8" >> $file
	echo "#@ node	= 1" >> $file
	echo "#@ wall_clock_limit	= 00:10:00" >> $file
	echo "#">> $file
	echo "#@ queue">> $file

	echo "">> $file
#	echo "cd \$PBS_O_WORKDIR">> $file
	echo "export XLSMPTOPTS=SPINS=0;YIELDS=0">> $file
	echo "export MALLOCMULTIHEAP=true">> $file
	echo "export OMP_NUM_THREADS=1">> $file
	echo "echo \$OMP_NUM_THREADS">> $file
	echo "../openmp-c/eg -i $data_file" >> $file
done

for data_file in ../data/*.in
do
	data_file_name=$(basename $data_file)_seq
	file=bassi/bench_$data_file_name.batch
	echo "#@ job_name	= like_$data_file_name" > $file
	echo "#@ output	= ../results/bassi/like_$data_file_name.out">> $file
	echo "#@ error	= ../results/bassi/like_$data_file_name.err">> $file
	echo "#@ job_type	= parallel" >> $file
	echo "#@ node_usage	= not_shared">> $file
	echo "#@ network.MPI = sn_all,not_shared,us">> $file
	echo "#@ class = regular">> $file
	echo "#@ shell	= /bin/sh">> $file
	echo "#">> $file
	echo "#">> $file
	echo "#@ tasks_per_node	= 8" >> $file
	echo "#@ node	= 1" >> $file
	echo "#@ wall_clock_limit	= 00:10:00" >> $file
	echo "#">> $file
	echo "#@ queue">> $file

	echo "">> $file
#	echo "cd \$PBS_O_WORKDIR">> $file
	echo "export XLSMPTOPTS=SPINS=0;YIELDS=0">> $file
	echo "export MALLOCMULTIHEAP=true">> $file
	echo "../openmp-cpp/eg -i $data_file" >> $file
done

